import { ApiVersoin } from '@/common/enums/httpEnum'

const Url = {
  couponList: `${ApiVersoin.V2}/customer/coupon-list`,
  exchangeCode: `${ApiVersoin.V2}/customer/exchange-code`,
  myCouponList: `/coupon/coupon-list`,
  payCouponPrice: `/pay/check-coupon`,
  customerData: `/customer/coupon-data`,
}

/*
 *优惠券列表
 */
export const couponList = (params) => uni.$uv.http.get(Url.couponList, { params, custom: { showLoading: true } })
/*
 *优惠券兑换
 */
export const exchangeCode = (data) => uni.$uv.http.post(Url.exchangeCode, data, { custom: { showLoading: true } })

/*
 *可使用优惠券
 */
export const myCouponList = (params) => uni.$uv.http.get(Url.myCouponList, { params, custom: { showLoading: true } })

/*
 *计算使用优惠券减免金额
 */
export const payCouponPrice = (params) => uni.$uv.http.get(Url.payCouponPrice, { params, custom: { showLoading: true } })
/*
 * 使用优惠券获取的可使用和不可使用列表
 */
export const customerData = (params) => uni.$uv.http.get(Url.customerData, { params, custom: { showLoading: true } })
